﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using System.Text;

public partial class Crm_editform : BaseCrm
{
    public static string cname = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
            //读取基本信息

            int formId = 0;
            if (StringHelper.isNum(Request.QueryString["formid"]))
            {
                formId = int.Parse(Request.QueryString["formid"]);
            }
            DataTable dt = BLL.DataBaseHelper.instance.GetModel("form","", "formid=" + formId);
            if (dt.Rows.Count > 0)
            {

                cname = dt.Rows[0]["cname"].ToString();
                txtFormName.Text = dt.Rows[0]["cname"].ToString();
                txtLimitSize.Text = dt.Rows[0]["limitsize"].ToString();
                txtRemark.Text = dt.Rows[0]["remark"].ToString();
                txtUpload_path.Text = dt.Rows[0]["upload_path"].ToString();
                txtSqlstr.Text = dt.Rows[0]["sqlstr"].ToString();
            }
          
        }
    }
   
 
    protected void btnSaveClick_Click(object sender, EventArgs e)
    {
        int formid = 0;
        if (StringHelper.isNum(Request.QueryString["formid"]))
        {
            formid = int.Parse(Request.QueryString["formid"]);
        }
        Hashtable hs = new Hashtable();
        hs.Add("cname", StringHelper.ReplaceBadChar(txtFormName.Text));
        hs.Add("upload_path", StringHelper.ReplaceBadChar(txtUpload_path.Text));
        hs.Add("limitsize", StringHelper.ReplaceBadChar(txtLimitSize.Text));
        hs.Add("remark", StringHelper.ReplaceBadChar(txtRemark.Text));
        hs.Add("sqlstr", txtSqlstr.Text.Trim());
        BLL.DataBaseHelper.instance.Update(hs, "Form", "formId=" + formid);
        btnSaveClick.Text = "已保存";
        btnSaveClick.Enabled = false;
    }

  
}
